package cn.tedu.csmall.stock.webapi.quartz;

import org.quartz.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ReduceCountConfig {
//    @Bean
    public JobDetail reduceCount(){
        return JobBuilder.newJob(ReduceCountJob.class)
                .withIdentity("reduceCount")
                .storeDurably()
                .build();
    }

//    @Bean
    public Trigger reduceCountTrigger(){
        CronScheduleBuilder cron = CronScheduleBuilder.cronSchedule("0/30 * * 2 2 ?");
        return TriggerBuilder.newTrigger()
                .forJob(reduceCount())
                .withIdentity("reduceCountTrigger")
                .withSchedule(cron)
                .build();
    }
}
